﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using System.ComponentModel;
using System.Collections.ObjectModel;

namespace Oroboros.Save_Data
{
    [XmlInclude(typeof(DefenceTaskSaveData)), XmlInclude(typeof(RepairGeneratorTaskSaveData))]
    public class TaskSaveData : INotifyPropertyChanged
    {
        private Guid myGuid;
        private string _DisplayName = string.Empty;
        private string _TaskClassName = string.Empty;
        private ObservableCollection<SkillWorkSaveData> _WorkCompleted;

        public TaskSaveData()
        {
            myGuid = Guid.Empty;
        }

        public string DisplayName { get { return _DisplayName; } set { Changed("DisplayName"); _DisplayName = value; } }
        public string TaskClassName { get { return _TaskClassName; } set { Changed("TaskClassName"); _TaskClassName = value; } }
        public ObservableCollection<SkillWorkSaveData> WorkCompleted { get { return _WorkCompleted; } set { Changed("WorkCompleted"); _WorkCompleted = value; } }

        public Guid Guid
        {
            get
            {
                return this.myGuid;
            }
            set
            {
                this.myGuid = value;
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;
        public void Changed(string n)
        {
            if (PropertyChanged == null) return;
            if (!string.IsNullOrEmpty(n))
                PropertyChanged(this, new PropertyChangedEventArgs(n));
        }

        public override string ToString()
        {
            return string.Format("Task {0}",DisplayName);
        }
    }
}
